#pragma once


#include <QObject>
#include <QGraphicsItem>
#include <QGraphicsView>
#include <QMouseEvent>
#include <QImage>
#include <QWheelEvent>
#include <QGraphicsScene>
#include <QGraphicsSceneWheelEvent>
#include <QScrollBar>

#include <QDebug>


 class BPointItem : public   QGraphicsObject
{
    //Q_OBJECT

public:
    BPointItem::BPointItem(QGraphicsItem* parent, QPointF p)
        //: QAbstractGraphicsShapeItem(parent)
        :QGraphicsObject(parent)
    {
        this->setPos(p);
        this->setFlags(QGraphicsItem::ItemIsSelectable |
                       QGraphicsItem::ItemIsMovable |
                       QGraphicsItem::ItemIsFocusable);
        this->setCursor(Qt::PointingHandCursor);

        /*  this->pen().setColor(Qt::black);
    this->pen().setStyle(Qt::SolidLine);

    this->brush().setColor(Qt::white);
    this->brush().setStyle(Qt::BrushStyle::SolidPattern);*/
        //pen.setStyle(Qt::SolidLine);
    }
protected:

    virtual QRectF boundingRect() const override
    {
        return QRectF(-2, -2, 4, 4);
    }
//    virtual void paint(QPainter *painter,const QStyleOptionGraphicsItem *option,QWidget *widget) override;
    virtual void BPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
    {
        Q_UNUSED(option);
        Q_UNUSED(widget);
        // 设置画笔
        QPen pen;
        pen.setColor(Qt::black);
        pen.setStyle(Qt::SolidLine);
        painter->setPen(pen);

        QBrush brush;
        brush.setColor(Qt::white);
        brush.setStyle(Qt::BrushStyle::SolidPattern);
        painter->setBrush(brush);

        //painter->setPen(this->pen());
        //painter->setBrush(this->brush());

        painter->drawEllipse(QRectF(-2, -2, 4, 4));
    }
//    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
//    void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
};


